package com.workflow.itrun.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.workflow.itrun.entity.Seckill;
import com.workflow.itrun.entity.SeckillExample;
import com.workflow.itrun.mapper.SeckillMapper;
import com.workflow.itrun.service.SeckillService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class SeckillServiceImpl implements SeckillService {

    @Autowired
    private SeckillMapper seckillMapper;

    @Override
    public PageInfo<Seckill> selectList(Integer pageIndex, Integer pageSize) {
        PageHelper.startPage(pageIndex,pageSize);
        log.info("分页查询秒杀商品列表");
        SeckillExample example=new SeckillExample();
        List<Seckill> seckills = seckillMapper.selectByExample(example);
        PageInfo<Seckill> result=new PageInfo<Seckill>(seckills);

        return result;
    }
}
